import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProCostConsumeVO, ProCostConsumeForm, ProCostConsumeQuery } from '@/api/project/cost/consume/types';

/**
 * 查询成本消耗列表
 * @param proId 项目ID
 * @returns {*}
 */

export const listProCostConsume = (proId: string | number): AxiosPromise<ProCostConsumeVO[]> => {
  return request({
    url: '/pro/cost/consume/list',
    method: 'get',
    params: { proId }
  });
};

/**
 * 查询成本消耗详细
 * @param id
 */
export const getProCostConsume = (id: string | number): AxiosPromise<ProCostConsumeVO> => {
  return request({
    url: '/pro/cost/consume/' + id,
    method: 'get'
  });
};

/**
 * 新增成本消耗
 * @param data
 */
export const addProCostConsume = (data: ProCostConsumeForm) => {
  return request({
    url: '/pro/cost/consume',
    method: 'post',
    data: data
  });
};

/**
 * 修改成本消耗
 * @param data
 */
export const updateProCostConsume = (data: ProCostConsumeForm) => {
  return request({
    url: '/pro/cost/consume',
    method: 'put',
    data: data
  });
};

/**
 * 删除成本消耗
 * @param id
 */
export const delProCostConsume = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pro/cost/consume/' + id,
    method: 'delete'
  });
};
